﻿using Commons.Commands.Results;
using Commons.Models.Users;
using Commons.Services.Users;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Commons.Commands
{
    public class CreateUserAccountCommand : Command
    {
        //injected
        public IUserService UserService { set; protected get; }

        public string UserName { set; get; }
        public string Password { set; get; }

        public override OperationResult Execute()
        {
            User user = UserService.CreateUser(UserName, Password);
            Dictionary<string, object> info = new Dictionary<string, object>();
            info["user"] = user;
            OperationResult result = new OperationResult(true, info);
            return result;
        }
    }
}
